package bold.deposit.useful.spring;

import org.springframework.util.StopWatch;

public class TestStopWatch {
    private void test() throws InterruptedException {
        StopWatch sw = new StopWatch();

        sw.start("起床");
        Thread.sleep(100);
        sw.stop();
        System.out.println(sw.getLastTaskName() + "耗时:" + sw.getTotalTimeMillis());

        sw.start("洗漱");
        Thread.sleep(100);
        sw.stop();

        Thread.sleep(100);

        sw.start("锁门");
        Thread.sleep(100);
        sw.stop();

        System.out.println(sw.prettyPrint());




    }


    public static void main(String[] argv) throws InterruptedException {
        new TestStopWatch().test();
    }
}
